﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:odc="clr-namespace:Odyssey.Controls"
        xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Odyssey;Component/Themes/Ribbon/RibbonSeparator.xaml" />
        <ResourceDictionary Source="pack://application:,,,/Odyssey;Component/Themes/Ribbon/RibbonHLChromeStyle.xaml" />
        <ResourceDictionary
                Source="pack://application:,,,/Odyssey;Component/Themes/Ribbon/RibbonGroupDropDownButton.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <odc:TwoLineConverter x:Key="twoLineConverter" />

    <ControlTemplate TargetType="{x:Type odc:RibbonGroup}" x:Key="{ComponentResourceKey odc:Skins, RibbonGroupTemplate}">
        <Grid>
            <odc:RibbonDropDownButton x:Name="PART_Button" Focusable="{TemplateBinding Focusable}"
                    IsDropDownPressed="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"
                    Visibility="Hidden" PopupAnimation="Fade" BorderBrush="{TemplateBinding BorderBrush}"
                    Foreground="{TemplateBinding Foreground}" Width="{TemplateBinding Width}"
                    Template="{StaticResource RibbonGroupDropDownButtonTemplate}" Height="{TemplateBinding Height}">
                <odc:RibbonDropDownButton.Content>
                    <StackPanel Height="84" Focusable="False">
                        <odc:RibbonChrome RenderFlat="False" Focusable="False" Width="31" Height="31" CornerRadius="4"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Background="{DynamicResource {ComponentResourceKey odc:Skins, SmallIconBgBrush}}"
                                Margin="5,2,5,4" HorizontalAlignment="Center" VerticalAlignment="Top">
                            <Image RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.EdgeMode="Aliased"
                                    Source="{TemplateBinding Image}" ClipToBounds="True" Focusable="False" Width="16"
                                    Height="16" Stretch="Fill" Margin="4,4,0,4" VerticalAlignment="Top"
                                    HorizontalAlignment="Center" />
                        </odc:RibbonChrome>
                        <ContentPresenter Focusable="False"
                                Content="{Binding Title, RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource twoLineConverter}}"
                                x:Name="title" Margin="2,0,2,0" VerticalAlignment="Center" HorizontalAlignment="Center"
                                MaxWidth="140" />
                        <Image x:Name="symbol"
                                Source="{DynamicResource {ComponentResourceKey odc:Skins, DownArrowImage}}"
                                Margin="1,4,0,0" Stretch="None" />

                    </StackPanel>
                </odc:RibbonDropDownButton.Content>
                <odc:RibbonDropDownButton.DropDownHeader>
                    <Border Background="{DynamicResource {ComponentResourceKey odc:Skins, RibbonTabBrush}}"
                            CornerRadius="3" BorderThickness="0">
                        <odc:RibbonChrome x:Name="popupchrome" BorderBrush="{TemplateBinding BorderBrush}"
                                Style="{DynamicResource {ComponentResourceKey odc:Skins, ExpandedRibbonGroupChromeStyle}}"
                                RenderMouseOver="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}">
                            <StackPanel Margin="0" Focusable="False">
                                <Border x:Name="PART_PopupItemsPanelHost" Padding="1,1,1,0" Focusable="False" />
                                <DockPanel Focusable="False">
                                    <Button Width="15" Height="14" DockPanel.Dock="Right" VerticalAlignment="Bottom"
                                            Margin="0,2,1,1" x:Name="launcher2"
                                            Command="{x:Static odc:RibbonGroup.LaunchDialogCommand}">
                                        <Button.Template>
                                            <ControlTemplate TargetType="{x:Type Button}">
                                                <odc:RibbonChrome RenderPressed="{TemplateBinding IsPressed}"
                                                        RenderMouseOver="{TemplateBinding IsMouseOver}" CornerRadius="0">
                                                    <Image RenderOptions.BitmapScalingMode="NearestNeighbor"
                                                            RenderOptions.EdgeMode="Aliased"
                                                            Source="{DynamicResource {ComponentResourceKey odc:Skins, LauncherButtonImage}}"
                                                            Margin="1,1,0,0" Stretch="None" />
                                                </odc:RibbonChrome>
                                            </ControlTemplate>
                                        </Button.Template>
                                    </Button>
                                    <ContentControl Focusable="False"
                                            Foreground="{DynamicResource {ComponentResourceKey odc:Skins, GroupTitleForegroundBrush}}"
                                            Content="{TemplateBinding Title}" VerticalAlignment="Center"
                                            HorizontalAlignment="Center" Height="16" />
                                </DockPanel>
                            </StackPanel>
                        </odc:RibbonChrome>
                    </Border>
                </odc:RibbonDropDownButton.DropDownHeader>
            </odc:RibbonDropDownButton>

            <odc:RibbonChrome x:Name="chrome1" Focusable="False"
                    Style="{DynamicResource {ComponentResourceKey odc:Skins, ExpandedRibbonGroupChromeStyle}}"
                    Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                    MouseOverBorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
                    RenderMouseOver="{TemplateBinding IsMouseOver}">
                <odc:RibbonChrome.Content>
                    <StackPanel Margin="{TemplateBinding Padding}" Focusable="False">
                        <Border Height="74" x:Name="PART_ItemsPanelHost" Padding="1,1,1,0" Focusable="False" />
                        <DockPanel Focusable="False">
                            <Button Width="15" Height="14" DockPanel.Dock="Right" VerticalAlignment="Bottom"
                                    Margin="0,2,1,1" x:Name="launcher"
                                    Command="{x:Static odc:RibbonGroup.LaunchDialogCommand}">
                                <Button.Template>
                                    <ControlTemplate TargetType="{x:Type Button}">
                                        <odc:RibbonChrome RenderPressed="{TemplateBinding IsPressed}"
                                                RenderMouseOver="{TemplateBinding IsMouseOver}" CornerRadius="0">
                                            <Image RenderOptions.BitmapScalingMode="NearestNeighbor"
                                                    RenderOptions.EdgeMode="Aliased"
                                                    Source="{DynamicResource {ComponentResourceKey odc:Skins, LauncherButtonImage}}"
                                                    Margin="1,1,0,0" Stretch="None" />
                                        </odc:RibbonChrome>
                                    </ControlTemplate>
                                </Button.Template>
                            </Button>
                            <TextBlock x:Name="groupTitle" TextTrimming="CharacterEllipsis" Focusable="False"
                                    Foreground="{DynamicResource {ComponentResourceKey odc:Skins, GroupTitleForegroundBrush}}"
                                    Text="{TemplateBinding Title}" VerticalAlignment="Center"
                                    HorizontalAlignment="Center" FontSize="11" Height="16" Visibility="Visible"
                                    Margin="0,2,0,0" />
                        </DockPanel>
                    </StackPanel>
                </odc:RibbonChrome.Content>
            </odc:RibbonChrome>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsDialogLauncherVisible" Value="False">
                <Setter Property="Visibility" Value="Collapsed" TargetName="launcher" />
            </Trigger>
            <Trigger Property="IsDialogLauncherVisible" Value="False">
                <Setter Property="Visibility" Value="Collapsed" TargetName="launcher2" />
            </Trigger>
            <Trigger Property="IsMinimized" Value="True">
                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ItemsPanelHost" />
                <Setter Property="Visibility" Value="Collapsed" TargetName="chrome1" />
                <Setter Property="Visibility" Value="Visible" TargetName="PART_Button" />
                <Setter Property="Visibility" Value="Collapsed" TargetName="groupTitle" />
            </Trigger>
        </ControlTemplate.Triggers>
        <ControlTemplate.Resources>
            <Style TargetType="{x:Type Separator}" BasedOn="{StaticResource RibbonSeparator}" />
            <Style TargetType="{x:Type odc:RibbonChrome}" BasedOn="{StaticResource RibbonChromeStyle}" />
        </ControlTemplate.Resources>
    </ControlTemplate>



    <Style TargetType="{x:Type odc:RibbonGroup}">
        <Setter Property="odc:KeyTip.Stop" Value="False" />
        <Setter Property="odc:KeyTip.XOffset" Value="-24" />
        <Setter Property="odc:KeyTip.YOffset" Value="-2" />
        <Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey odc:Skins, DefaultBorderBrush}}" />
        <Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey odc:Skins, RibbonForegroundBrush}}" />
        <Setter Property="MinWidth" Value="48" />
        <Setter Property="MinHeight" Value="88" />
        <Setter Property="Margin" Value="2" />
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey odc:Skins, RibbonGroupTemplate}}" />
        <Setter Property="Focusable" Value="False" />
    </Style>
</ResourceDictionary>